package com.example.order_system.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description: 系统配置文件
 * @author: chengbaiyi
 * @create: 2022-08-27 15:32
 */
@Configuration
public class AppConfig implements WebMvcConfigurer {
    @Autowired
    private LoginIntercept loginIntercept;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercept).addPathPatterns("/**").
                excludePathPatterns("/user/login").
                excludePathPatterns("/user/reg").
                excludePathPatterns("/css/**").
                excludePathPatterns("/img/**").
                excludePathPatterns("/js/**").
                excludePathPatterns("/**/index.html").
                excludePathPatterns("/**/admin.html");
    }
}
